<?php
session_start();
include('connection.php');
if(isset($_SESSION['username']) || isset($_SESSION['password']))
{
?>
<html>
 <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">

    <title>Starter Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">

    <!-- Custom styles for this template -->
   

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
    
       <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>

         <script src="js/bootstrap.js"></script>  
         
         <script src="datepicker/js/bootstrap-datepicker.js"></script>
                 <script type="text/javascript">
 $(function(){
	  $("#news").submit(function(e){
		  
		
       e.preventDefault();
 
      
			dataString= $('#news').serialize();
			$.ajax({
			
			type: "POST",
			url: "updateevent.php",
			data: dataString,
				success: function(response){
					
					alert(response);
				
		}
		});});
	  $('.dpYears').datepicker();
 });

</script>

         <link href="datepicker/css/datepicker.css" rel="stylesheet"/>
         <link href="datepicker/less/datepicker.less" rel="stylesheet" />
      

    
    
  </head>
  <body>
<?php include('addminmenu.php'); ?>
<div class="container" style="margin-top:107px;">
	
<?php                   
if(isset($_GET['event_id']))
{
$event_id=$_GET['event_id'];
$sql="SELECT * from event WHERE event_id=$event_id ";
$result=mysql_query($sql,$con);
$row=mysql_fetch_array($result);
$event_id=$row['event_id'];
$title=$row['title'];
$start_date=$row['start_date'];
$expire_date=$row['expire_date'];
$description=$row['description'];
   $status=$row['status'];                 
 ?>
 <div><a href="module.php">Module</a> >> <a href="list.php?list=event"> List</a> >> <?php echo $title; ?></div>
<div class="row">
    <div class="col-sm-8 col-sm-offset-2">
<div class="table">
					<form id="news" method="post" name="form" class="form-horizontal" role="form" action="">
                    <input type="hidden" value="<?PHP echo $event_id;?>" name="event_id">  
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr><td>Title</td><td><input type="text" class="form-control" name="eventname" value="<?php echo $title; ?>"/></td></tr>
<tr><td>Starting Date</td><td><div class="input-append date dpYears" style="position:relative;" id="" data-date="12-02-2012" data-date-format="dd-mm-yyyy" data-date-viewmode="years">
				<input class="span2 form-control" size="16"  name="start_date"  type="text" value="<?php echo $start_date; ?>" placeholder="Start Date" required >
				<span class="add-on"><i class="glyphicon glyphicon-calendar"></i></span>
			  </div></td></tr>
<tr><td>Expiration Date</td><td><div class="input-append date dpYears" style="position:relative;" id="" data-date="12-02-2012" data-date-format="dd-mm-yyyy" data-date-viewmode="years">
				<input class="span2 form-control" size="16"  name="expire_date"  type="text" value="<?php echo $expire_date; ?>" placeholder="Start Date" required >
				<span class="add-on"><i class="glyphicon glyphicon-calendar"></i></span>
			  </div></td></tr>
<tr><td>Event Detail</td><td><textarea rows="5"  cols="22" name="description"  class="form-control"><?php echo $description; ?></textarea></td></tr>
<tr><td>Status</td><td><select name="status" class="form-control">
        
          <option value="1" <?php if($status==1){?>  selected <?php }?>  >Enable</option>
          <option value="0" <?php if($status==0){?>  selected <?php }?>   >Disable</option>
        
          </select></td></tr>	
</table>
					

			
						<!-- Pagging -->
						<div class="buttons">
								<input type="submit" id="submit" class="button"value="submit"><input type="reset" class="button" value="Reset">
</div>				</form>

<?php
}
?>
					</div>
                    </div>
                    </div>
                    </div>
                    <?PHP

}
else
{	header("location:index.php");
}
?>
</body>
</html>